/*
 * 	<pre>
 *	EasyPeas.
 *  Copyright (C) 2007 S Owen
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 * 
 * Jul 24, 2007
 * View.java
 * </pre>
 */
package org.easypeas.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * <p>
 * Represents a GET and populates properties before being processed by the
 * template engine. The attribute <em>name</em> maps to the part of the path
 * in the URI.<br>
 * By default the template used is <em>name.vm</em>, but the attribute
 * <em>template</em> can override this. <br>
 * e.g <br>
 * <br>
 * <code>
 * &#064View(name="list", template="showlist.vm")<br>
 * public void showList()<br> 
 * <br>
 * => /easypea/showlist
 * </p>
 * <br>
 * A method can act as both a View and an Action, but it must differentiate 
 * within the method, and if it is an Action it must return a String.
 * @author S Owen
 *
 * @see Action
 */
@Retention(value = RetentionPolicy.RUNTIME)
@Target(value = ElementType.METHOD)
public @interface View {

	/**
	 * Provides a name to the view which must be unique for all GET methods for
	 * this EasyPea.<br>
	 * The name maps to the part of the URL path after the EasyPea name, or an
	 * EasyPea returned from an accessor;<br>
	 * e.g. GET /books/list => will invoke the view named <em>list</em> on an
	 * <br>
	 * EasyPea named <em>books</em>.
	 */
	String name();

	/**
	 * Overrides the default template used to process a view, the default being
	 * equal to the <em>name</em>.vm <br>
	 * Setting this attribute will override this. Currently this must be the
	 * full path (relative to the context) , which will often be the in a
	 * directory named after EasyPea name.
	 */
	String template() default "";
}
